<template>
	<div class="myBox">
		<div class="L"><img :src="LoginUser.avatar" /></div>
		<div class="C">
			<div class="tit">{{ LoginUser.nickname }}</div>
			<div class="sub">{{ LoginUser.createtime }}</div>
		</div>
		<div class="R"><img src="/assets/images/go.png" /></div>
	</div>
	<div class="clear"></div>
	<div class="allkbox"></div>
	<div class="myboxcon" @click="toPage('/business/profile')">
		<p>基本资料</p>
		<img src="/assets/images/go.png" />
	</div>
	<div class="myboxcon" @click="email">
		<p>邮箱认证</p>
		<img src="/assets/images/go.png" />
	</div>
	<div class="myboxcon" @click="toPage('/business/address/index')">
		<p>我的收货地址</p>
		<img src="/assets/images/go.png" />
	</div>
	<div class="myboxcon" @click="toPage('/business/order/index')">
		<p>我的订单</p>
		<img src="/assets/images/go.png" />
	</div>
	<div class="myboxcon" @click="toPage('/business/record')">
		<p>消费记录</p>
		<img src="/assets/images/go.png" />
	</div>
	
	<div class="myboxcon" @click="toPage('/business/topup')">
		<p>充值中心</p>
		<img src="/assets/images/go.png" />
	</div>
	<div class="myboxcon" @click="toPage('/business/paylist')">
		<p>充值记录</p>
		<img src="/assets/images/go.png" />
	</div>
	<div class="myboxcon" @click="logout">
		<p>退出登录</p>
		<img src="/assets/images/go.png" />
	</div>

	<div class="clear"></div>
	<div class="h54"></div>
	<div class="clear"></div>
	<!-- 底部 -->
	<Bottom />
</template>

<script setup>
	import Bottom from "@/components/public/bottom.vue";
	const router = useRouter();
	let { cookies } = useCookies();
	let LoginUser = reactive(cookies.get("LoginUser"));
	// 退出功能
	let logout = () => {
		showConfirmDialog({
			title: "退出登录",
			message: "确认退出登录吗？",
		})
			.then(() => {
				cookies.remove("LoginUser");
				showSuccessToast({
					message: "退出成功",
					onClose: function () {
						router.push("/business/login");
					},
				});
			})
			.catch(() => {
				// on cancel
			});
	};
	// 跳转公共方法
	let toPage = (url) => {
		router.push(url);
	};
	let email = () => {
		if(LoginUser['auth']==1){
			showSuccessToast('邮箱已经验证了')
			return
		}
        router.push("/business/email");
    };
</script>

<style>
</style>